package com.example.qiandao.repository;

import com.example.qiandao.entity.CheckinRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CheckinRecordRepository extends JpaRepository<CheckinRecord, Long> {
    List<CheckinRecord> findByCheckinHistoryId(Long checkinHistoryId);

    CheckinRecord findByStudentIdAndCheckinHistoryId(Long userId, Long checkinHistoryId);
    @Query("SELECT cr FROM CheckinRecord cr WHERE cr.student.id = :studentId AND cr.checkinHistory.clazz.id = :classId")
    List<CheckinRecord> findByStudentIdAndClassId(@Param("studentId") Long studentId, @Param("classId") Long classId);
}